﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using BLL.Validation;
using Utilities;

namespace BLL
{
     public class DangKiManager
    {
         public static ActionResult<int> ThemDangKi(DangKy dk)
         {
             var aResult = new ActionResult<int>();
             try
             {
                 aResult.Result = DangKiProvider.ThemDangKi(dk);
                 if (aResult.Result <= 0)
                 {
                     aResult.Exceptions.Add(new Exception("Thêm mới đăng ký không thành công"));
                 }
             }
             catch (Exception ex)
             {
                 aResult.Exceptions.Add(ex);
             }
             return aResult;
         }
         public static ActionResultAsList<DangKy> LayDanhSachDangKy()
         {
             var aResult = new ActionResultAsList<DangKy>();
             try
             {
                 aResult.Result = DangKiProvider.LayDanhSachDangKy();
             }
             catch (Exception ex)
             {
                 aResult.Exceptions.Add(ex);
             }
             return aResult;
         }
    }
}
